package com.lz.flow.official;

import java.util.Arrays;

/**
 * @Classname: com.lz.flow.official.ds
 * @Description: TODO
 *
 * @Date: 2019/1/8 10:18
 * @Created by: li
 * @Version: V1.0
 */
public class ds {
    //Create Publisher
    public static void main(String[] args) {

        SubmissionPublisher<String> publisher = new SubmissionPublisher<>();

        //Register Subscriber
        MySubscriber<String> subscriber = new MySubscriber<>();
        publisher.subscribe(subscriber);

        //Publish items
        System.out.println("Publishing Items...");
        String[] items = {"1", "x", "2", "x", "3", "x"};
        Arrays.asList(items).stream().forEach(i -> publisher.submit(i));
        publisher.close();
    }
}
